<template>
  <a-card :bordered="false">
    <a-steps class="steps" :current="currentTab">
      <a-step title="排班信息" />
      <a-step title="排班职工" />
      <a-step title="完成" />
    </a-steps>
    <div class="content">
      <rule-step1 v-if="currentTab === 0" @nextStep="nextStep"/>
      <rule-step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep"/>
      <rule-step3 v-if="currentTab === 2" @prevStep="prevStep" @finish="finish"/>
    </div>
  </a-card>
</template>

<script>
  import RuleStep1 from '../update/RuleStep1'
  import RuleStep2 from '../update/RuleStep2'
  import RuleStep3 from '../update/RuleStep3'
  import CommonRuleParams from '@views/his/scheduling/RuleForm/CommonSchedulingRuleParams'

  export default {
    name: "OrdStoreRuleStepForm",
    components: {
      RuleStep1,
      RuleStep2,
      RuleStep3,
    },
    data () {
      return {
        description: '供餐规则',
        currentTab: 0,
        // form
        form: null,
      }
    },
    created() {
      console.log('TaskStepForm.vue created');

      CommonRuleParams.commonRuleForm1Data = {
        selectedRowKeys:[],
        dataSource: [],
        switchFullscreen: false
      }
      CommonRuleParams.commonOrdCpRuleForm2Data = {
        dataSource: {}
      }
      CommonRuleParams.commonOrdCpRuleForm4Data = {
        httpFlag:true,
        title: '操作成功',
        errorMsg:''
      }
    },
    methods: {
      // handler
      nextStep () {
        if (this.currentTab < 3) {
          this.currentTab += 1
        }
      },
      prevStep () {
        if (this.currentTab > 0) {
          this.currentTab -= 1
        }
      },
      finish () {
        CommonRuleParams.commonOrdCpRuleForm1Data = {
          selectedRowKeys:[],
          dataSource: [],
          switchFullscreen: false
        }
        CommonRuleParams.commonOrdCpRuleForm2Data = {
          dataSource: {}
        }
        CommonRuleParams.commonOrdCpRuleForm4Data = {
          httpFlag:true,
          title: '操作成功',
          errorMsg:''
        }

        this.currentTab = 0
      }
    }
  }
</script>

<style lang="less" scoped>
  .steps {
    max-width: 1000px;
    margin: 16px auto;
  }
</style>